// hannota.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include<iostream>
using namespace std;

void hannota(char x/*from*/,char y,char z/*to*/,int n)
{
    if(n==0)
    {
        return;
    }
    else if(n==1)
    {
        cout<<x<<" to "<<z<<endl;
    }
    else
    {
        hannota(x,z,y,n-1);
        hannota(x,y,z,1);
        hannota(y,x,z,n-1);
    }
}

int _tmain(int argc, _TCHAR* argv[])
{
    hannota('a','b','c',3);
	return 0;
}

